package com.example.dmdomain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "users")
@Data
public class User {

    @Id
    /**
     * 用户id
     */
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private String userId;


    /**
     * 手机号
     */
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "phone")
    private String phone;

    /**
     * 密码
     */
    @Column(name = "password")
    private String password;

    /**
     * 微信code
     */
    @Column(name = "weixin_code")
    private String weixinCode;

    /**
     * 微信id
     */
    @Column(name = "weixin_id")
    private String weixinId;

    /**
     * 微信名
     */
    @Column(name = "weixin_name")
    private String weixinName;

    /**
     * create_time
     */
    @CreatedDate
    @Column(name = "create_time", updatable = false)
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * update_time
     */
    @CreatedDate
    @Column(name = "update_time", updatable = false)
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 地址
     */
    @Column(name = "address")
    private String address;

    /**
     * 账号注册类型
     */
    @Column(name = "register_type")
    private String registerType;

    /**
     * 用户的标识，对当前公众号唯一
     */
    @Column(name = "open_id")
    private String openId;

    /**
     * 只有在用户将公众号绑定到微信开放平台账号后，才会出现该字段。
     */
    @Column(name = "union_id")
    private String unionId;

    @Column(name = "account_type")
    private Integer accountType;

    @Column(name = "auth_end_time")
    private Date authEndTime;

    public User() {
    }
}
